#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <wait.h>


int g=5;

int main(int argc, char**argv){
	pid_t pid;
	int l=5;
	int *t=malloc(sizeof(int));
	*t=5;

	printf("g=%d, l=%d, *t=%d\n",g,l,*t);


	switch(pid=fork()){
		case 0:
			g++;l++;*t++;
			printf("g=%d, l=%d, *t=%d\n",g,l,*t);
			exit(0);
		
		default:
			g--;l--;*t--;
			printf("g=%d, l=%d, *t=%d\n",g,l,*t);
			wait(NULL);
	}
	
	return 0;
}
